/*  Replication files for

Supplementary Materials

Plutzer, Eric, Mark McCaffrey, A. Lee Hannah, Joshua Rosenau, Minda Berbeco,
and Ann H. Reid. 2016. "Climate change education in U.S. Middle and High schools." Science

Replication Files

Created by Lee Hannah

1.28.2016

Email: plutzer@psu.edu; lee.hannah@wright.edu 

*/

clear 
**
** Read in data-- need to set path file name

*cd "PATH FILE NAME HERE"

use "Climate_Confusion_Replication_February2016_Release.dta"


/*
Figure S1 - Distribution of Responses (%) to teaching emphasis scale
*/

*** Create dependent variable (Remove NA from analysis of emphasis)
replace q4_naturalcauses = . if q4_naturalcauses == 5
replace q4_sciconsensus = . if q4_sciconsensus == 5 

gen emph_diff = (q4_naturalcauses - q4_sciconsensus)/3

hist emph_diff, percent 


***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************


/*
Table S1. Percentage devoting at least one class hour to recent global warming, 
and the mean number of class hours devoted, among those who taught the subject, 
weighted versus unweighted data.
*/

gen q1_taughtgw = .
replace q1_taughtgw = 0 if q1_globalwarm == 1
replace q1_taughtgw = 1 if q1_globalwarm >1

label var q1_taughtgw "Teacher taught global warming" 

label define q1_gw 0 "No"
label define q1_gw 1 "Yes", add
label values q1_taughtgw q1_gw

tab subject  q1_taughtgw, row  

** Unweighted
/*
     1 bio; 2 |
        earth |
   science; 3 |
   physics; 4 | Teacher taught global
     chem ; 5 |        warming
middle school |        No        Yes |     Total
--------------+----------------------+----------
      biology |        43        265 |       308 
              |     13.96      86.04 |    100.00 
--------------+----------------------+----------
earth science |        14        271 |       285 
              |      4.91      95.09 |    100.00 
--------------+----------------------+----------
      physics |        78         78 |       156 
              |     50.00      50.00 |    100.00 
--------------+----------------------+----------
    chemistry |        85         98 |       183 
              |     46.45      53.55 |    100.00 
--------------+----------------------+----------
middle school |       164        404 |       568 
              |     28.87      71.13 |    100.00 
--------------+----------------------+----------
        Total |       384      1,116 |     1,500 
              |     25.60      74.40 |    100.00 

*/

** Weighted
tab subject q1_taughtgw [aweight = anal_wt], row 

/*
     1 bio; 2 |
        earth |
   science; 3 |
   physics; 4 | Teacher taught global
     chem ; 5 |        warming
middle school |        No        Yes |     Total
--------------+----------------------+----------
      biology |  55.76169  366.33646 |422.098154 
              |     13.21      86.79 |    100.00 
--------------+----------------------+----------
earth science | 4.2757583  91.711788 | 95.987546 
              |      4.45      95.55 |    100.00 
--------------+----------------------+----------
      physics | 125.97773  123.68219 | 249.65992 
              |     50.46      49.54 |    100.00 
--------------+----------------------+----------
    chemistry |  77.37021   90.89923 | 168.26944 
              |     45.98      54.02 |    100.00 
--------------+----------------------+----------
middle school | 165.19256  398.79238 | 563.98494 
              |     29.29      70.71 |    100.00 
--------------+----------------------+----------
        Total | 428.57795  1,071.422 |     1,500 
              |     28.57      71.43 |    100.00 
*/

** Unweighted

gen q1_num_globalwarm = q1_globalwarm


**** MULTIPLE PUNCH RESPONDENTS INDICATED ON VERIFICATION LOGS
** SRCID=="12644" scored 1 and 4 (none and 6-10) but answered extensively on Q3
replace q1_globalwarm = 4 if SRCID=="12644" 


foreach var of varlist q1_num_globalwarm*{
recode `var' 1 = 0
recode `var' 2 = 1.5
recode `var' 3 = 4
recode `var' 4 = 8
recode `var' 5 = 13
recode `var' 6 = 18
recode `var' 7 = 25
}
replace q1_num_globalwarm = 4 if q1_globalwarm == 3

tabstat q1_num_globalwarm if q1_globalwarm!= 1, by(subject)


/*

      subject |      mean
--------------+----------
      biology |  4.156283
earth science |  6.030772
      physics |  4.059772
    chemistry |  3.486295
middle school |  4.425481
--------------+----------
        Total |  4.348801
-------------------------

*/


** Weighted
tabstat q1_num_globalwarm [aw = anal_wt] if q1_globalwarm!= 1, by(subject)

/*
      subject |      mean
--------------+----------
      biology |  4.114943
earth science |  6.111321
      physics |  3.973333
    chemistry |  3.296875
middle school |  4.412658
--------------+----------
        Total |  4.625458
-------------------------

*/


***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************
***********************************************************

/*
Table S3. Logistic regression of response propensity (listwise n = 4,844)
*/

** NOTE ORIGINAL DATASET OF THE ENTIRE SAMPLE IS NOT POSTED
** RESPONSE PROPENSITY BASED ON VARIABLES THAT MIGHT PROVIDE IDENTIFYING INFORMATION


/*
Table S4. Return rates among eligible respondents, by racial and ethnic composition
of the school (sample size in smaller font, italic)
*/

** NOTE ORIGINAL DATASET OF THE ENTIRE SAMPLE IS NOT POSTED
** RESPONSE PROPENSITY BASED ON VARIABLES THAT MIGHT PROVIDE IDENTIFYING INFORMATION


/*
Table S7. Formal class hours devoted to recent global warming
*/
** 70% of middle-school science teachers and 87% of high school biology teachers

tab subject q1_globalwarm [aw=anal_wt], row

/*
     1 bio; 2 |
        earth |
   science; 3 |
   physics; 4 | ...please indicate how many class hours (40-50 minutes) you typically spend
     chem ; 5 |                                     on..
middle school | not cover  1-2 hours  3-5 hours  6-10 hour  11-15 hou  16-20 hou  20 hours  |     Total
--------------+-----------------------------------------------------------------------------+----------
      biology |  55.67577 192.595638   104.3387  31.058844 17.8121523 8.33857018  6.5032093 | 416.32288 
              |     13.37      46.26      25.06       7.46       4.28       2.00       1.56 |    100.00 
--------------+-----------------------------------------------------------------------------+----------
earth science | 4.2691699   30.63391  29.042686  14.115043  8.9809388   3.496883  3.4547202 |  93.99335 
              |      4.54      32.59      30.90      15.02       9.55       3.72       3.68 |    100.00 
--------------+-----------------------------------------------------------------------------+----------
      physics | 125.78362  77.701209  20.304012  10.064111   5.891952          0  5.1470666 | 244.89197 
              |     51.36      31.73       8.29       4.11       2.41       0.00       2.10 |    100.00 
--------------+-----------------------------------------------------------------------------+----------
    chemistry | 77.250994   56.43086  20.134202  6.1799605  5.3818076          0  1.0528082 | 166.43063 
              |     46.42      33.91      12.10       3.71       3.23       0.00       0.63 |    100.00 
--------------+-----------------------------------------------------------------------------+----------
middle school | 164.93802  194.84936  118.70006  37.869305  15.490377  15.838584  6.6754631 | 554.36117 
              |     29.75      35.15      21.41       6.83       2.79       2.86       1.20 |    100.00 
--------------+-----------------------------------------------------------------------------+----------
        Total | 427.91757  552.21098 292.519655  99.287264  53.557228  27.674037  22.833268 |     1,476 
              |     28.99      37.41      19.82       6.73       3.63       1.87       1.55 |    100.00 
*/





/*
S8. Regression predicting emphasis scale (all independent variables are scored 0-1 unless 
otherwise indicated)
*/

** Emphasis Scale

** Model
/*
LEE IS FOLLOWING UP ON HOW SOME OF THE CONTROLS WERE CALCULATED. WILL ALSO INCLUDE CODE THAT PRODUCES
THE DEPENDENT VARIABLE

emphasis = biology + earth science + physics + chemistry + middle school + female + yearstaught + knowledge + 
exposure to climate change + priority to foils + selected 81-100 + govrolescale + constant 

N = 1074, R2 = 0.41

*/
* this totals the number of missing answers to the 18 questions.  
* scores of 0-17 indicate that the respondent answered at least one question
** Created in original dataset
* egen nmis=rmiss2(q21*)

** The following assigns a score of zero courses to all questions if the respondent answered
***  at least a single question in the q21 grid
/*


replace q21_sectionclimate_college = 0 if q21_sectionclimate_college == . & nmis < 18
replace q21_courseclimate_college = 0 if q21_courseclimate_college == . & nmis < 18
replace q21_sectionclimate_conted = 0 if q21_sectionclimate_conted == . & nmis < 18
replace q21_courseclimate_conted = 0 if q21_courseclimate_conted == . & nmis < 18
replace q21_courseclimate_opp = 2 if q21_courseclimate_opp == . & nmis < 18
*/
*** Create dependent variable (Remove NA from analysis of emphasis)


*** Then create initial educational exposure measure in two steps:
** First:
** Created in original dataset
* gen ed_summary = .
* replace ed_summary= (10*q21_courseclimate_college) +q21_sectionclimate_college
tab ed_summary [aw=anal_wt]

/*
 ed_summary |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 | 819.444156       57.14       57.14 None at all (57.14%)
          1 | 247.406014       17.25       74.40 Only one class covered the topic (17.25%)
          2 |133.2741657        9.29       83.69 Two or more courses covered topic (9.29+2.41+2.90 =
          3 |34.52587018        2.41       86.10
          4 | 41.5611492        2.90       89.00
         10 | 5.25002863        0.37       89.36 One course entirely focused on cc (96.67 - 89.0 = 6.67
         11 | 37.3444999        2.60       91.97
         12 | 31.7003946        2.21       94.18
         13 | 11.3187707        0.79       94.97
         14 | 17.9383818        1.25       96.22
         20 | 5.11221371        0.36       96.57  Two or omre courses (100 - 96.22 = 3.8)
         21 |1.369845542        0.10       96.67
         22 | 18.4702964        1.29       97.96
         23 | 1.87170486        0.13       98.09
         24 | 10.9505471        0.76       98.85
         30 | 1.10052325        0.08       98.93
         33 |  2.6866272        0.19       99.12
         34 | .304888091        0.02       99.14
         40 | 1.17500056        0.08       99.22
         42 | .873129192        0.06       99.28
         44 |10.32179345        0.72      100.00
------------+-----------------------------------
      Total |      1,434      100.00

*/
**** Second: Class exposure variables need to be collapsed
** Created in original dataset
/*
gen college_summary=.
replace college_summary = 0 if ed_summary==0
replace college_summary = 1 if ed_summary==1
replace college_summary = 2 if ed_summary>=2 & ed_summary<10
replace college_summary = 3 if ed_summary>=10 & ed_summary<20
replace college_summary = 4 if ed_summary>=20
replace college_summary = . if ed_summary == .

label define course 1 "One exposure"
label define course 2 "Two or more exposures", add
label define course 3 "One entire class", add
label define course 4 "2+ classes", add
label define course 0 "None", add
label values college_summary course
*/
tab college_summary [aw=anal_wt]

/*      college_summary |      Freq.     Percent        Cum.
----------------------+-----------------------------------
                 None | 819.444156       57.14       57.14
         One exposure | 247.406014       17.25       74.40
Two or more exposures | 209.361185       14.60       89.00
     One entire class |103.5520756        7.22       96.22
           2+ classes | 54.2365693        3.78      100.00
----------------------+-----------------------------------
                Total |      1,434      100.00


*/
** foils

replace q8_aerosol = . if q8_aerosol == 5
replace q8_ozone = . if q8_ozone == 5
replace q8_pesticid = . if q8_pesticid == 5
replace q8_rockets = . if q8_rockets == 5

tab1 q8_aerosol q8_ozone q8_pesticid q8_rockets

gen foils01 = ((-1* (q8_aerosol+q8_ozone+q8_pesticid+q8_rockets))+16)/12
tab foils01
sum foils01

alpha q8_aerosol q8_ozone q8_pesticid q8_rockets, std item detail gen(foil_alpha)
sum foil_alpha

gen foil_alpha01 = round((foil_alpha + 2.356893)/5.252563 , .01)
sum foil_alpha01

/*
    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
foil_alpha01 |      1428    .4473179    .1486916          0          1


*/

************** Consensus awareness binary variable  ************
gen consens80 = .
replace consens80 = 1 if q18_humanpct==5
replace consens80 = 0 if q18_humanpct< 5
replace consens80 = 0 if q18_humanpct==6
tab q18_humanpct consens80, missing

/*
 to the best |
     of your |
  knowledge, |
        what |
  proportion |
  of climate |
  scientists |            consens80
 think that  |         0          1          . |     Total
-------------+---------------------------------+----------
     0 - 20% |        27          0          0 |        27 
   21% - 40% |        90          0          0 |        90 
   41% - 60% |       177          0          0 |       177 
   61% - 80% |       299          0          0 |       299 
  81% - 100% |         0        583          0 |       583 
i don't know |       293          0          0 |       293 
           . |         0          0         31 |        31 
-------------+---------------------------------+----------
       Total |       886        583         31 |     1,500 

*/  

***** Government role scale (-1 to +1) *****
*recoding govrole to -1 to +1
gen govrole = (q19_govrole-4)/3
tab govrole
/*
    govrole |      Freq.     Percent        Cum.
------------+-----------------------------------
         -1 |         52        3.55        3.55
  -.6666667 |         64        4.37        7.92
  -.3333333 |        105        7.17       15.09
          0 |        260       17.75       32.83
   .3333333 |        372       25.39       58.23
   .6666667 |        380       25.94       84.16
          1 |        232       15.84      100.00
------------+-----------------------------------
      Total |      1,465      100.00
*/

gen female = 0
replace female = 1 if q27_gender == 2 

* Then estimate the model
reg emph_diff i.subject  female q25_yrsteach i.college_summary i.q23_climate foil_alpha01 consens80 govrole [pw=nonres_wt]

/*

Linear regression                                      Number of obs =    1052
                                                       F( 16,  1035) =   51.07
                                                       Prob > F      =  0.0000
                                                       R-squared     =  0.4095
                                                       Root MSE      =  .34338

------------------------------------------------------------------------------------------------------------
                                           |               Robust
                                emph_diff2 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------------------------------------+----------------------------------------------------------------
                                   subject |
                            earth science  |  -.0963641   .0326876    -2.95   0.003    -.1605058   -.0322225
                                  physics  |  -.0384377   .0460017    -0.84   0.404    -.1287049    .0518294
                                chemistry  |  -.1081083    .041919    -2.58   0.010    -.1903643   -.0258523
                            middle school  |  -.0592277   .0293544    -2.02   0.044    -.1168286   -.0016267
                                           |
                                    female |   .0477783   .0227747     2.10   0.036     .0030885    .0924681
                              q25_yrsteach |  -.0031244   .0011515    -2.71   0.007     -.005384   -.0008648
                                           |
                           college_summary |
                             One exposure  |   .0269637   .0306212     0.88   0.379     -.033123    .0870503
                    Two or more exposures  |   .0090471   .0296897     0.30   0.761    -.0492118    .0673059
                         One entire class  |   .0124912   .0459456     0.27   0.786    -.0776659    .1026483
                               2+ classes  |  -.0362972   .0458589    -0.79   0.429    -.1262842    .0536897
                                           |
                               q23_climate |
     typical of most high school teachers  |   .0176235   .0344288     0.51   0.609    -.0499347    .0851816
very good compared to most high school ..  |   .0726909   .0405315     1.79   0.073    -.0068425    .1522242
exceptional: on par with many college-l..  |   .1289623   .0807127     1.60   0.110     -.029417    .2873415
                                           |
                              foil_alpha01 |   .0880711   .0750663     1.17   0.241    -.0592283    .2353706
                                 consens80 |   .3202919   .0262151    12.22   0.000      .268851    .3717328
                                   govrole |   .3370012   .0258398    13.04   0.000     .2862969    .3877055
                                     _cons |   .0379788   .0540817     0.70   0.483    -.0681436    .1441011
------------------------------------------------------------------------------------------------------------

. 

*/









